<template>
  <div class="tan" v-show="show">
    <div>{{ message }}</div>
  </div>
</template>
<script>
export default {
  name: "Toast",
  // props: {
  //   message: {
  //     type: String,
  //     default: "",
  //   },
  // },
  data() {
    return {
      message: "",
      show: true,
    };
  },
  methods: {
    show(message, time) {
      this.show = true;
      this.message = message;
      setTimeout(() => {
        this.show = false;
        this.message = "";
      }, time);
    },
  },
};
</script>
<style scoped>
.tan {
  position: fixed;
  top: 50%;
  left: 50%;
  color: #fff;
  transform: translate(-50%, -50%);
  background-color: rgba(0, 0, 0, 0.7);
  padding: 8px, 10px;
}
</style>